<template>
    <section>
      <city-header></city-header>
      <city-search></city-search>
      <city-list :cityList="cityList"></city-list>
      <city-alphabet :cities="cities"></city-alphabet>
    </section>
</template>

<script>
import CityHeader from './components/Header'
import CitySearch from './components/Search'
import CityList from './components/List'
import CityAlphabet from './components/Alphabet'
import axios from 'axios'
export default {
  name: 'City',
  components: {
    CityHeader,
    CitySearch,
    CityList,
    CityAlphabet
  },
  data () {
    return {
      cityList: {
        hotCities: [],
        cities: {}
      },
      cities: {}
    }
  },
  methods: {
    getCityInfo () {
      axios.get('/api/city.json').then(this.getCityInfoSuc)
    },
    getCityInfoSuc (res) {
      const resdata = res.data
      if (resdata.ret === true) {
        this.cityList = resdata.data
        this.cities = resdata.data.cities
      }
    }
  },
  mounted () {
    this.getCityInfo()
  }
}
</script>

<style lang="less" scoped>

</style>
